﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using backoffice.Data;
using System.Linq.Expressions;

namespace backoffice.Business
{
    public class BusinessMaterial
    {
        #region Create
        public static void createMaterial(Material m)
        {
            try
            {
                dataMaterial.createMaterial(m);
            }
            catch (Exception e)
            {
                Messages.AddDebug(e.Message);
                throw new Exception("Error creating material");
            }
        }

        public static void createMaterial(String name, String description, String image)
        {
            try
            {
                Material m = new Material();
                m.Name = name;
                m.Description = description;
                //m.Image = image;
            }
            catch (Exception e)
            {
                Messages.AddDebug(e.Message);
                throw new Exception("Error creating material");
            }
        }
        #endregion

        #region Get
        public static Material getMaterial(Guid guid)
        {
            try
            {
                return dataMaterial.getMaterial(guid);
            }
            catch (Exception e)
            {
                Messages.AddDebug(e.Message);
                throw new Exception("Error getting material");
            }
        }
        #endregion

        #region Set
        public static Boolean changeMaterial(Material m)
        {
            try
            {
                return dataMaterial.changeMaterial(m);
            }
            catch (Exception e)
            {
                Messages.AddDebug(e.Message);
                throw new Exception("Error change material");
            }
        }
        #endregion

        #region Delete
        public static Boolean deleteMaterial(Material m)
        {
            try
            {
                return dataMaterial.deleteMaterial(m);
            }
            catch (Exception e)
            {
                Messages.AddDebug(e.Message);
                throw new Exception("Error deleting material");
            }
        }
        #endregion
    }
}
